list = [["姓名", "年龄", "籍贯"], ["张三", "18", "湖北"], ["李四", "19", "上海"], ["王五", "20", "北京"]]

with open("test.csv", "wt", encoding="utf-8") as file:
    for row in list:
        file.write(",".join(row))
        file.write("\n")
    file.close()

with open("test.csv", "rt", encoding="utf-8") as file:
    for row in file:
        print(row, end="")
    file.close()
